package com.ygqh.baby.model;

import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author: sunshuo
 * @date: 2019/2/18 11:57
 */
public class WdtOrderImportExcelModel implements Serializable {

	private static final long serialVersionUID = 3500463289958053412L;

	/**
	 * 店铺名称
	 */
	private String shopName;

	/**
	 * 原始单号
	 */
	private String sourceOrderCode;

	/**
	 * 收件人
	 */
	private String receiver;

	/**
	 * 省
	 */
	private String province;

	/**
	 * 市
	 */
	private String city;

	/**
	 * 区
	 */
	private String area;

	/**
	 * 手机
	 */
	private String telPhone;

	/**
	 * 固话
	 */
	private String fixedLine;

	/**
	 * 邮编
	 */
	private String zipCode;

	/**
	 * 网名
	 */
	private String username;

	/**
	 * 地址
	 */
	private String address;

	/**
	 * 发货方式
	 */
	private String sendType;

	/**
	 * 应收合计
	 */
	private BigDecimal totalReceivable;

	/**
	 * 邮费
	 */
	private BigDecimal postage;

	/**
	 * 优惠金额
	 */
	private BigDecimal discountedPrice;

	/**
	 * COD买家费用
	 */
	private BigDecimal codBuyerFees;

	/**
	 * 下单时间
	 */
	private String orderTime;

	/**
	 * 付款时间
	 */
	private String payTime;

	/**
	 * 买家备注
	 */
	private String buyerRemark;

	/**
	 * 客服备注
	 */
	private String customerRemark;

	/**
	 * 发票抬头
	 */
	private String invoiceTitle;

	/**
	 * 发票内容
	 */
	private String invoiceContent;

	/**
	 * 支付方式
	 */
	private String payType;

	/**
	 * 商家编码
	 */
	private String skuCode;

	/**
	 * 货品数量
	 */
	private Long goodsQuantity;

	/**
	 * 货品价格
	 */
	private BigDecimal goodsPrice;

	/**
	 * 货品总价
	 */
	private BigDecimal goodsTotalPrice;

	/**
	 * 货品优惠
	 */
	private BigDecimal goodsDiscountedPrice;

	/**
	 * 源子订单号
	 */
	private String sourceSubOrderCode;

	/**
	 * 备注
	 */
	private String remark;

	/**
	 * 错误信息
	 */
	private String errMsg;

	public String getShopName() {
		return shopName;
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	public String getSourceOrderCode() {
		return sourceOrderCode;
	}

	public void setSourceOrderCode(String sourceOrderCode) {
		this.sourceOrderCode = sourceOrderCode;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}

	public String getTelPhone() {
		return telPhone;
	}

	public void setTelPhone(String telPhone) {
		this.telPhone = telPhone;
	}

	public String getFixedLine() {
		return fixedLine;
	}

	public void setFixedLine(String fixedLine) {
		this.fixedLine = fixedLine;
	}

	public String getZipCode() {
		return zipCode;
	}

	public void setZipCode(String zipCode) {
		this.zipCode = zipCode;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getSendType() {
		return sendType;
	}

	public void setSendType(String sendType) {
		this.sendType = sendType;
	}

	public BigDecimal getTotalReceivable() {
		return totalReceivable;
	}

	public void setTotalReceivable(BigDecimal totalReceivable) {
		this.totalReceivable = totalReceivable;
	}

	public BigDecimal getPostage() {
		return postage;
	}

	public void setPostage(BigDecimal postage) {
		this.postage = postage;
	}

	public BigDecimal getDiscountedPrice() {
		return discountedPrice;
	}

	public void setDiscountedPrice(BigDecimal discountedPrice) {
		this.discountedPrice = discountedPrice;
	}

	public BigDecimal getCodBuyerFees() {
		return codBuyerFees;
	}

	public void setCodBuyerFees(BigDecimal codBuyerFees) {
		this.codBuyerFees = codBuyerFees;
	}

	public String getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(String orderTime) {
		this.orderTime = orderTime;
	}

	public String getPayTime() {
		return payTime;
	}

	public void setPayTime(String payTime) {
		this.payTime = payTime;
	}

	public String getBuyerRemark() {
		return buyerRemark;
	}

	public void setBuyerRemark(String buyerRemark) {
		this.buyerRemark = buyerRemark;
	}

	public String getCustomerRemark() {
		return customerRemark;
	}

	public void setCustomerRemark(String customerRemark) {
		this.customerRemark = customerRemark;
	}

	public String getInvoiceTitle() {
		return invoiceTitle;
	}

	public void setInvoiceTitle(String invoiceTitle) {
		this.invoiceTitle = invoiceTitle;
	}

	public String getInvoiceContent() {
		return invoiceContent;
	}

	public void setInvoiceContent(String invoiceContent) {
		this.invoiceContent = invoiceContent;
	}

	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	public String getSkuCode() {
		return skuCode;
	}

	public void setSkuCode(String skuCode) {
		this.skuCode = skuCode;
	}

	public Long getGoodsQuantity() {
		return goodsQuantity;
	}

	public void setGoodsQuantity(Long goodsQuantity) {
		this.goodsQuantity = goodsQuantity;
	}

	public BigDecimal getGoodsPrice() {
		return goodsPrice;
	}

	public void setGoodsPrice(BigDecimal goodsPrice) {
		this.goodsPrice = goodsPrice;
	}

	public BigDecimal getGoodsTotalPrice() {
		return goodsTotalPrice;
	}

	public void setGoodsTotalPrice(BigDecimal goodsTotalPrice) {
		this.goodsTotalPrice = goodsTotalPrice;
	}

	public BigDecimal getGoodsDiscountedPrice() {
		return goodsDiscountedPrice;
	}

	public void setGoodsDiscountedPrice(BigDecimal goodsDiscountedPrice) {
		this.goodsDiscountedPrice = goodsDiscountedPrice;
	}

	public String getSourceSubOrderCode() {
		return sourceSubOrderCode;
	}

	public void setSourceSubOrderCode(String sourceSubOrderCode) {
		this.sourceSubOrderCode = sourceSubOrderCode;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	@Override
	public String toString() {
		return "WdtOrderImportExcelModel{" +
				"shopName='" + shopName + '\'' +
				", sourceOrderCode='" + sourceOrderCode + '\'' +
				", receiver='" + receiver + '\'' +
				", province='" + province + '\'' +
				", city='" + city + '\'' +
				", area='" + area + '\'' +
				", telPhone='" + telPhone + '\'' +
				", fixedLine='" + fixedLine + '\'' +
				", zipCode='" + zipCode + '\'' +
				", username='" + username + '\'' +
				", address='" + address + '\'' +
				", sendType='" + sendType + '\'' +
				", totalReceivable=" + totalReceivable +
				", postage=" + postage +
				", discountedPrice=" + discountedPrice +
				", codBuyerFees=" + codBuyerFees +
				", orderTime='" + orderTime + '\'' +
				", payTime='" + payTime + '\'' +
				", buyerRemark='" + buyerRemark + '\'' +
				", customerRemark='" + customerRemark + '\'' +
				", invoiceTitle='" + invoiceTitle + '\'' +
				", invoiceContent='" + invoiceContent + '\'' +
				", payType='" + payType + '\'' +
				", skuCode='" + skuCode + '\'' +
				", goodsQuantity=" + goodsQuantity +
				", goodsPrice=" + goodsPrice +
				", goodsTotalPrice=" + goodsTotalPrice +
				", goodsDiscountedPrice=" + goodsDiscountedPrice +
				", sourceSubOrderCode='" + sourceSubOrderCode + '\'' +
				", remark='" + remark + '\'' +
				", errMsg='" + errMsg + '\'' +
				'}';
	}

	public void addErrMsg(String errMsg) {
		if (this.errMsg == null) {
			this.errMsg = "";
		}
		this.errMsg = this.errMsg + errMsg;
	}

	public void validateParam() {
		StringBuilder errMsg = new StringBuilder();
		if (StringUtils.isBlank(shopName)) {
			errMsg.append("店铺名称为空；");
		}
		if (StringUtils.isBlank(sourceOrderCode)) {
			errMsg.append("原始单号为空；");
		}
		/*if (StringUtils.isBlank(receiver)) {
			errMsg.append("收件人为空；");
		}
		if (StringUtils.isBlank(address)) {
			errMsg.append("地址为空；");
		}
		if (StringUtils.isBlank(sendType)) {
			errMsg.append("发货方式为空；");
		}
		if (postage == null) {
			errMsg.append("邮费为空；");
		}
		if (discountedPrice == null) {
			errMsg.append("优惠金额为空；");
		}*/
		if (StringUtils.isBlank(skuCode)) {
			errMsg.append("商家编码为空；");
		}
		if (goodsQuantity == null) {
			errMsg.append("货品数量为空；");
		} else if (goodsQuantity == 0) {
			errMsg.append("货品数量为0；");
		}
		if (errMsg.length() > 0) {
			this.addErrMsg(errMsg.toString());
		}
	}
}
